home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Glypha 3.02 / source / Code ƒ / F-GlyphaGuts.p < prev    next >
Encoding:
Text File  |  1990-09-20  |  18.3 KB  |  687 lines  |  [TEXT/PJMM]

  1. unit GlyphaGuts;
  2.  
  3. interface
  4.     uses
  5.         Dialogs, Sound, Enemies, GameUtils;
  6.  
  7.     procedure DoAStoneHit (whichStone: Rect);
  8.     procedure MoveThePlayer;
  9.     procedure CheckTombStones;
  10.     procedure AnimateTheAnk;
  11.     procedure AdvanceALevel;
  12.     procedure EnterANewMortal;
  13.     procedure DoEnd;
  14.     procedure ExitAMortal;
  15.     procedure SlideTheStones;
  16.  
  17. implementation
  18.  
  19. {=================================}
  20.  
  21.     procedure DoOnTheGround;
  22.         var
  23.             onLand: Boolean;
  24.             index: Integer;
  25.             tempRect, dummyRect: Rect;
  26.     begin
  27.         with thePlayer do
  28.             begin
  29.                 if (state) then        {taking off from the ground}
  30.                     begin
  31.                         DoTheSound('flap.snd', TRUE);
  32.                         state := FALSE;
  33.                         mode := 5;
  34.                         ChangeRect;
  35.                         vertVel := liftAmount;
  36.                     end
  37.                 else                            {but if not flapping...}
  38.                     begin
  39.                         onLand := FALSE;
  40.                         tempRect := dest;
  41.                         InsetRect(tempRect, 17, 0);
  42.                         OffsetRect(tempRect, 0, 2);
  43.                         for index := startStone to numberOfStones do
  44.                             if (SectRect(tombRects[index], tempRect, dummyRect)) then
  45.                                 onLand := TRUE;
  46.                         if not onLand then
  47.                             begin
  48.                                 mode := 4;
  49.                                 ChangeRect;
  50.                                 vertVel := fallAmount;
  51.                             end
  52.                         else                            {on solid ground}
  53.                             begin
  54.                                 if (keyStillDown) then    {and running}
  55.                                     begin
  56.                                         horiVel := running[horiVel, facing, 0];
  57.                                         mode := running[horiVel, facing, 1];
  58.                                         if ((mode = 0) or (mode = 2)) then
  59.                                             DoTheSound('walk.snd', TRUE);
  60.                                     end
  61.                                 else                            {not running, we're braking - screeeech}
  62.                                     begin
  63.                                         mode := 1;
  64.                                         horiVel := idleLanded[horiVel];
  65.                                         if (horiVel <> 0) then
  66.                                             DoTheSound('screech.snd', TRUE);
  67.                                     end;                        {end - else, key still down}
  68.                             end;                            {end - else, not on solid ground}
  69.                     end;                                {end - else, not flapping to take off}
  70.                 dest.left := dest.left + horiVel;
  71.                 dest.right := dest.right + horiVel;
  72.                 dest.top := dest.top + vertVel;
  73.                 dest.bottom := dest.bottom + vertVel;
  74.             end;
  75.     end;
  76.  
  77. {=================================}
  78.  
  79.     procedure DoAStoneHit;
  80.     begin
  81.         with thePlayer do
  82.             begin
  83.                 if (horiVel > 0) then
  84.                     begin
  85.                         if (dest.left < whichStone.left) then    {hit the edge}
  86.                             begin
  87.                                 dest.left := dest.left + whichStone.left - whichStone.right;
  88.                                 dest.right := dest.right + whichStone.left - whichStone.right;
  89.                                 horiVel := impacted[horiVel];
  90.                             end
  91.                         else
  92.                             begin
  93.                                 if (vertVel < 0) then                            {hit coming up}
  94.                                     begin
  95.                                         vertVel := impacted[vertVel];
  96.                                         OffsetRect(dest, 0, whichStone.bottom - dest.top);
  97.                                     end
  98.                                 else
  99.                                     begin
  100.                                         if (mode = 6) then
  101.                                             begin
  102.                                                 DoTheSound('boom1.snd', TRUE);
  103.                                                 OffsetRect(dest, 0, whichStone.top - dest.bottom);
  104.                                                 vertVel := 0;
  105.                                                 horiVel := 0;
  106.                                                 mode := 50;
  107.                                                 ChangeRect;
  108.                                                 Exit(DoAStoneHit);
  109.                                             end;
  110.                                         if (vertVel < 4) or (dest.right > whichStone.right) then
  111.                                             begin
  112.                                                 DoTheSound('screech.snd', TRUE);
  113.                                                 vertVel := -3;
  114.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom);
  115.                                             end
  116.                                         else
  117.                                             begin
  118.                                                 DoTheSound('walk.snd', TRUE);
  119.                                                 vertVel := 0;
  120.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom - 10);
  121.                                                 mode := 1;
  122.                                                 ChangeRect;
  123.                                             end;
  124.                                     end;
  125.                             end;
  126.                     end
  127.                 else
  128.                     begin
  129.                         if (dest.right > whichStone.right) then    {hit the edge}
  130.                             begin
  131.                                 OffsetRect(dest, whichStone.right - whichStone.left, 0);
  132.                                 horiVel := impacted[horiVel];
  133.                             end
  134.                         else
  135.                             begin
  136.                                 if (vertVel < 0) then        {hit coming up}
  137.                                     begin
  138.                                         vertVel := impacted[vertVel];
  139.                                         OffsetRect(dest, 0, whichStone.bottom - dest.top);
  140.                                     end
  141.                                 else
  142.                                     begin
  143.                                         if (mode = 6) then
  144.                                             begin
  145.                                                 DoTheSound('boom1.snd', TRUE);
  146.                                                 OffsetRect(dest, 0, whichStone.top - dest.bottom);
  147.                                                 vertVel := 0;
  148.                                                 horiVel := 0;
  149.                                                 if (mortals <= 1) then
  150.                                                     mode := 7
  151.                                                 else
  152.                                                     mode := 50;
  153.                                                 ChangeRect;
  154.                                                 Exit(DoAStoneHit);
  155.                                             end;
  156.                                         if (vertVel < 4) or (dest.left < whichStone.left) then
  157.                                             begin
  158.                                                 DoTheSound('screech.snd', TRUE);
  159.                                                 vertVel := -3;
  160.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom);
  161.                                             end
  162.                                         else
  163.                                             begin
  164.                                                 DoTheSound('walk.snd', TRUE);
  165.                                                 vertVel := 0;
  166.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom - 10);
  167.                                                 mode := 1;
  168.                                                 ChangeRect;
  169.                                             end;
  170.                                     end;
  171.                             end;
  172.                     end;
  173.             end;
  174.     end;
  175.  
  176. {=================================}
  177.  
  178.     procedure DoInTheAir;
  179.         var
  180.             index: Integer;
  181.             tempRect, dummyRect: Rect;
  182.     begin
  183.         with thePlayer do
  184.             begin
  185.                 if (keyStillDown) then
  186.                     horiVel := gliding[horiVel, facing];
  187.                 if (state) then
  188.                     begin
  189.                         DoTheSound('flap.snd', TRUE);
  190.                         mode := 5;
  191.                         state := FALSE;
  192.                         vertVel := vertVel + liftAmount;
  193.                     end
  194.                 else
  195.                     begin
  196.                         if (vertVel < maxFall) then
  197.                             vertVel := vertVel + fallAmount;
  198.                         if (vertVel > 0) then
  199.                             mode := 4
  200.                         else
  201.                             mode := 5;
  202.                     end;
  203.                 dest.left := dest.left + horiVel;
  204.                 dest.right := dest.right + horiVel;
  205.                 dest.top := dest.top + vertVel;
  206.                 dest.bottom := dest.bottom + vertVel;
  207.                 for index := startStone to numberOfStones do
  208.                     begin
  209.                         if SectRect(dest, tombRects[index], dummyRect) then
  210.                             DoAStoneHit(dummyRect);
  211.                     end;
  212.             end;
  213.     end;
  214.  
  215. {=================================}
  216.  
  217.     procedure DoFallingSkeleton;
  218.         var
  219.             index: Integer;
  220.             dummyRect: Rect;
  221.     begin
  222.         with thePlayer do
  223.             begin
  224.                 if (vertVel < maxFall) then
  225.                     vertVel := vertVel + fallAmount;
  226.                 dest.left := dest.left + horiVel;
  227.                 dest.right := dest.right + horiVel;
  228.                 dest.top := dest.top + vertVel;
  229.                 dest.bottom := dest.bottom + vertVel;
  230.                 for index := startStone to numberOfStones do
  231.                     begin
  232.                         if SectRect(dest, tombRects[index], dummyRect) then
  233.                             DoAStoneHit(dummyRect);
  234.                     end;
  235.             end;
  236.     end;
  237.  
  238. {=================================}
  239.  
  240.     procedure DoDeadBones;
  241.     begin
  242.         with thePlayer do
  243.             begin
  244.                 if (mode < 8) then
  245.                     begin
  246.                         OffsetRect(dest, 0, 1);
  247.                         dest.bottom := dest.bottom - 1;
  248.                         if (dest.bottom = dest.top) then
  249.                             begin
  250.                                 deadAndGone := TRUE;
  251.                                 CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, playRgn);
  252.                             end;
  253.                     end
  254.                 else
  255.                     mode := mode - 1;
  256.             end;
  257.     end;
  258.  
  259. {=================================}
  260.  
  261.     procedure MoveThePlayer;
  262.  
  263.     begin
  264.         case thePlayer.mode of
  265.             0..3: 
  266.                 begin
  267.                     DoOnTheGround;
  268.                     CheckTombStones;
  269.                 end;
  270.             4..5: 
  271.                 begin
  272.                     DoInTheAir;
  273.                     CheckTombStones;
  274.                 end;
  275.             6: 
  276.                 begin
  277.                     DoFallingSkeleton;
  278.                     CheckTombStones;
  279.                 end;
  280.             7..100: 
  281.                 DoDeadBones;
  282.         end;
  283.     end;
  284.  
  285. {=================================}
  286.  
  287.     procedure CheckTombStones;
  288.         var
  289.             hori, vert: Integer;
  290.             dummyRect: Rect;
  291.     begin
  292.         with thePlayer do
  293.             begin
  294.                 if (not SectRect(dest, playRect, dummyRect)) then    {Player has left the screen    }
  295.                     begin
  296.                         if (dest.top > playRect.bottom) then
  297.                             begin
  298.                                 if (otherState) then
  299.                                     begin
  300.                                         OffsetRect(dest, 0, 1);
  301.                                         if (dest.top > playRect.bottom + 10) then
  302.                                             deadAndGone := TRUE;
  303.                                         Exit(CheckTombStones);
  304.                                     end
  305.                                 else
  306.                                     begin
  307.                                         DoTheSound('bird.snd', TRUE);
  308.                                         OffsetRect(dest, 0, playRect.bottom - dest.top + 1);
  309.                                         otherState := TRUE;
  310.                                         Exit(CheckTombStones);
  311.                                     end;
  312.                             end
  313.                         else
  314.                             begin
  315.                                 if (dest.bottom <= playRect.top) then
  316.                                     begin
  317.                                         vertVel := impacted[vertVel];
  318.                                         OffSetRect(dest, 0, playRect.top - dest.bottom + 1);
  319.                                     end
  320.                                 else
  321.                                     begin
  322.                                         if (dest.right < playRect.left) then
  323.                                             begin
  324.                                                 CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, playRgn);
  325.                                                 OffsetRect(dest, 511, 0);
  326.                                                 oldDest := dest;
  327.                                             end
  328.                                         else
  329.                                             begin
  330.                                                 if (dest.left > playRect.right) then
  331.                                                     begin
  332.                                                         CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, playRgn);
  333.                                                         OffsetRect(dest, -511, 0);
  334.                                                         oldDest := dest;
  335.                                                     end;
  336.                                             end;
  337.                                     end;
  338.                             end;
  339.                     end;
  340.             end;
  341.     end;
  342.  
  343. {=================================}
  344.  
  345.     procedure AnimateTheAnk;
  346.         var
  347.             index, index2, howHigh: Integer;
  348.             dummyLong: LongInt;
  349.             newRect, tempRect: Rect;
  350.             theEvent: EventRecord;
  351.     begin
  352.         DoTheSound('lightning.snd', TRUE);
  353.         if ((numberOfStones > 4) and (DoRandom(2) = 0) and (not stonesSliding)) then
  354.             begin
  355.                 SetRect(newRect, 247, 121, 263, 145);
  356.                 howHigh := upperLevel;
  357.                 OffsetRect(thePlayer.dest, 0, -172);
  358.                 thePlayer.oldDest := thePlayer.dest;
  359.             end
  360.         else
  361.             begin
  362.                 SetRect(newRect, 247, 292, 263, 316);
  363.                 howHigh := lowerLevel;
  364.             end;
  365.         CopyMask(offPlayerMap, offPlayerMap, mainWndo^.portBits, ankRects[0, source], ankRects[0, mask], newRect);
  366.         StrikeLightning(howHigh);
  367.         StrikeLightning(howHigh);
  368.         StrikeLightning(howHigh);
  369.  
  370.         tempRect := thePlayer.dest;
  371.         FlushEvents(everyEvent, 0);
  372.         lastLoopTime := TickCount;
  373.  
  374.         for index := 0 to 60 do        {Here's where the player flashes in get-ready mode    }
  375.             begin
  376.                 DoTheSound('rez.snd', TRUE);
  377.                 CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil);
  378.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, ankRects[0, source], ankRects[0, mask], newRect);
  379.                 CopyBits(offLoadMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, nil);
  380.                 if (stonesSliding) then
  381.                     SlideTheStones;
  382.                 UpdateEye;
  383.                 HandleTheEnemies;
  384.                 DrawBeasts;
  385.                 CopyBits(offVirginMap, offLoadMap, newRect, newRect, srcCopy, nil);
  386.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerRects[0, 1], playerRects[2, 1], tempRect);
  387.                 CopyBits(offLoadMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, nil);
  388.                 if (EventAvail(playMask, theEvent) or Button) then
  389.                     begin
  390.                         if ((theEvent.what = MouseDown) or (theEvent.what = keyDown) or Button) then
  391.                             begin
  392.                                 thePlayer.otherState := FALSE;
  393.                                 Exit(AnimateTheAnk);
  394.                             end;
  395.                     end;
  396.                 if (stonesSliding) then
  397.                     SlideTheStones;
  398.                 UpdateEye;
  399.                 HandleTheEnemies;
  400.                 if (theHand.state) then
  401.                     RetractTheHand;
  402.                 DrawBeasts;
  403.             end;
  404.     end;
  405.  
  406. {=================================}
  407.  
  408.     procedure AdvanceALevel;
  409.         var
  410.             index, aNumber, anotherNumber: Integer;
  411.     begin
  412.         if (score > 0) then                        {Compute the time bonus (if any) to the score.    }
  413.             aNumber := 2000 - gameCycle        {If they cleared it in less than 2000 cycles        }
  414.         else
  415.             aNumber := 0;
  416.         if (aNumber < 0) then                    {But don't SUBTRACT from their score, even    }
  417.             aNumber := 0;                            {if they took forever.  Just add zero.}
  418.         score := score + aNumber;                {Add it...                                                }
  419.         CheckExtraMortal;
  420.         oldScore := Score;                            {Keep a hold on this score.                }
  421.         levelOn := levelOn + 1;
  422.  
  423.         if (levelOn = 3) then
  424.             stonesSliding := TRUE
  425.         else
  426.             stonesSliding := FALSE;
  427.         DoTheHoopla;
  428.  
  429.         with theEye do
  430.             begin
  431.                 otherMode := 0;
  432.                 mode := (levelOn * 10) - 1500;
  433.                 if (mode > -100) then
  434.                     mode := -100;
  435.                 dest := eyeRects[4];
  436.                 OffsetRect(dest, -43, 70);
  437.                 if (DoRandom(2) = 0) then
  438.                     OffsetRect(dest, 0, 100);
  439.                 oldDest := dest;
  440.             end;
  441.  
  442.         beastsActive := 0;
  443.         beastsKilled := 0;
  444.  
  445.         if ((levelOn div 5) = (levelOn / 5)) then
  446.             begin                                {Every fifth wave is an egg wave!!}
  447.                 if (onFastMachine) then
  448.                     begin
  449.                         totalToKill := 8;                {In "slow mode" we assume they are on a MacII    }
  450.                         numberOfEnemies := 8;        {so we give them nine eggs to clear.                    }
  451.                         beastsActive := 8;
  452.                     end
  453.                 else
  454.                     begin
  455.                         totalToKill := 6;                {In fast mode we only give them 6.  Nine would    }
  456.                         numberOfEnemies := 6;        {be slow the machine down too much.                }
  457.                         beastsActive := 6;
  458.                     end;
  459.                 for index := 1 to numberOfEnemies do
  460.                     with theEnemies[index] do
  461.                         begin
  462.                             mode := -DoRandom(300) + levelOn;
  463.                             if (mode > -100) then
  464.                                 mode := DoRandom(50) - 150;
  465.                             otherState := TRUE;
  466.                             facing := DoRandom(2);
  467.                             aNumber := DoRandom(2);                    {Now we figure out where the sphinx is    }
  468.                             anotherNumber := DoRandom(100) + 10;    {to appear.  What platform, what side.    }
  469.                             if (facing = 0) then
  470.                                 begin
  471.                                     if aNumber = 0 then
  472.                                         SetRect(dest, anotherNumber, 74, 22 + anotherNumber, 96)
  473.                                     else
  474.                                         SetRect(dest, anotherNumber, 190, 22 + anotherNumber, 212);
  475.                                 end
  476.                             else
  477.                                 begin
  478.                                     if aNumber = 0 then
  479.                                         SetRect(dest, 400 + anotherNumber, 74, 422 + anotherNumber, 96)
  480.                                     else
  481.                                         SetRect(dest, 400 + anotherNumber, 190, 422 + anotherNumber, 212);
  482.                                 end;
  483.                             oldDest := dest;
  484.                         end;
  485.             end
  486.         else
  487.             begin            {a normal 'non-egg' wave}
  488.                 totalToKill := levelOn div 5 + 4;
  489.                 numberOfEnemies := levelOn div 5 + 1;
  490.                 if ((numberOfEnemies > 3) and (not onFastMachine)) then
  491.                     numberOfEnemies := 3
  492.                 else if (numberOfEnemies > 5) then
  493.                     numberOfEnemies := 5;
  494.                 for index := 1 to numberOfEnemies do
  495.                     with theEnemies[index] do
  496.                         begin
  497.                             mode := 150 + DoRandom(100);
  498.                             DoEnemyPlacement(index);
  499.                         end;
  500.             end;
  501.  
  502.         for index := 1 to numberOfEnemies do
  503.             with theEnemies[index] do
  504.                 begin
  505.                     state := FALSE;
  506.                     aNumber := DoRandom(levelOn);    {What type of sphinx?  O, 1 or 2?  Well, on level 1,    }
  507.                     if (aNumber > 20) then                {there is a 0% chance that a random # between 0 &    }
  508.                         otherMode := 2                            {0 will be greater than 20...so, no tough sphinx.        }
  509.                     else                                                    {But on level 30, aNumber will be a random number    }
  510.                         begin                                                {between 0 and 29.  That gives us almost a 33%        }
  511.                             if (aNumber > 10) then        {chance that it will be a sphinx 2, if not a sphinx 2,    }
  512.                                 otherMode := 1                    {(not >20) then a good 50% chance that aNumber>10    }
  513.                             else                                            {(11 to 20) and thus a sphinx 1.  Note: there is        }
  514.                                 otherMode := 0;                    {ALWAYS a CHANCE of the easiest sphinx 0, but it    }
  515.                         end;                                                {gets increasingly unlikely as the player goes on.        }
  516.                     vertVel := 0;
  517.                     horiVel := 0;
  518.                 end;
  519.  
  520.         with theHand do
  521.             begin
  522.                 dest := handRects[source, 0];
  523.                 OffsetRect(dest, 100, 270);
  524.                 oldDest := dest;
  525.                 state := FALSE;
  526.                 onward := FALSE;
  527.                 mode := 0;
  528.             end;
  529.  
  530.         growRate := levelOn div 3 + 1;
  531.         if (growRate > 8) then
  532.             growRate := 8;
  533.         numberOfStones := 2;
  534.         startStone := 0;
  535.         if (levelOn < 3) then
  536.             tombRects[0] := tombRects[-1]
  537.         else
  538.             tombRects[0] := tombRects[-2];
  539.  
  540.         if (levelOn = 3) then
  541.             begin
  542.                 tombRects[5] := tombRects[-4];
  543.                 numberOfStones := numberOfStones + 2;
  544.             end
  545.         else
  546.             tombRects[5] := tombRects[-3];
  547.  
  548.         if (((levelOn + 4) / 5) = ((levelOn + 4) div 5)) then
  549.             numberOfStones := numberOfStones + 3;
  550.         if ((levelOn / 5) = (levelOn div 5)) then
  551.             numberOfStones := numberOfStones + 3;
  552.         if (((levelOn + 3) / 5) = ((levelOn + 3) div 5)) then
  553.             numberOfStones := numberOfStones + 2;
  554.         if (((levelOn + 2) / 5) = ((levelOn + 2) div 5)) then
  555.             numberOfStones := numberOfStones + 2;
  556.         RedoTheBackground;
  557.         gameCycle := 0;
  558.         FlushEvents(everyEvent, 0);
  559.     end;
  560.  
  561. {=================================}
  562.  
  563.     procedure EnterANewMortal;
  564.     begin
  565.         with thePlayer do
  566.             begin
  567.                 facing := 0;
  568.                 mode := 0;
  569.                 horiVel := 0;
  570.                 vertVel := 0;
  571.                 dest := absoluteRects[facing, mode];
  572.                 OffSetRect(dest, 238, 267);
  573.                 oldDest := dest;
  574.                 if (theEye.mode > 0) then
  575.                     theEye.mode := 272;
  576.                 state := FALSE;
  577.             end;
  578.         keyStillDown := FALSE;
  579.         playing := TRUE;
  580.         pausing := FALSE;
  581.         deadAndGone := FALSE;
  582.         AnimateTheAnk;
  583.     end;
  584.  
  585. {===================================}
  586.  
  587.     procedure DoEnd;
  588.         var
  589.             index: Integer;
  590.             dummyLong: LongInt;
  591.             tempRect: Rect;
  592.     begin
  593.         DoTheSound('music.snd', FALSE);                    {Play the theme song, but wait for it to finish    }
  594.         playing := FALSE;
  595.         pausing := FALSE;
  596.         RedoTheBackground;
  597.         ShowScore;
  598.         tempRect := gameoverRects[0];
  599.         OffsetRect(tempRect, -105, -100);
  600.         for index := 1 to 5 do
  601.             begin
  602.                 CopyMask(offPlayerMap, offPlayerMap, mainWndo^.portBits, gameoverRects[1], gameoverRects[1], tempRect);
  603.                 Delay(4, dummyLong);
  604.                 CopyMask(offPlayerMap, offPlayerMap, mainWndo^.portBits, gameoverRects[0], gameoverRects[1], tempRect);
  605.                 Delay(4, dummyLong);
  606.             end;
  607.  
  608.         with theEye do
  609.             begin
  610.                 dest := eyeRects[4];
  611.                 OffsetRect(dest, -43, 70);
  612.                 oldDest := dest;
  613.             end;
  614.  
  615.         Delay(120, dummyLong);
  616.  
  617.         InitCursor;
  618.         FinalScore;
  619.         RedoTheBackground;
  620.         SetEventMask(EveryEvent);
  621.         RedrawHiScores;
  622.         if (downOffset < 20) then
  623.             begin
  624.                 InsertMenu(AppleMenu, 0);        {Insert this menu into the menu bar}
  625.                 InsertMenu(GameMenu, 0);        {Insert this menu into the menu bar}
  626.                 InsertMenu(OptionsMenu, 0);    {Insert this menu into the menu bar}
  627.                 DrawMenuBar;                    {Draw the menu bar}
  628.                 FlashMenuBar(0);
  629.             end;
  630.     end;
  631.  
  632. {=================================}
  633.  
  634.     procedure ExitAMortal;
  635.         var
  636.             aNumber: Integer;
  637.     begin
  638.         mortals := mortals - 1;
  639.         UnionRect(thePlayer.oldDest, thePlayer.dest, thePlayer.wholeRect);
  640.         CopyBits(offVirginMap, mainWndo^.portBits, thePlayer.wholeRect, thePlayer.wholeRect, srcCopy, playRgn);
  641.         if (mortals <= 0) then                            {Game over, dude}
  642.             begin
  643.                 DoEnd;
  644.             end
  645.         else
  646.             begin
  647.                 EnterANewMortal;
  648.             end;
  649.     end;
  650.  
  651. {=================================}
  652.  
  653.     procedure SlideTheStones;
  654.         var
  655.             oldStone1, oldStone2, newStone1, newStone2, stoneSrc: Rect;
  656.     begin
  657.         SetRect(stoneSrc, 166, 316, 346, 332);
  658.         oldStone1 := stoneSrc;
  659.         oldStone2 := stoneSrc;
  660.         OffsetRect(tombRects[5], 1, 0);
  661.         OffsetRect(tombRects[6], -1, 0);
  662.         OffsetRect(oldStone1, tombRects[5].left - stoneSrc.left, 0);
  663.         OffsetRect(oldStone2, tombRects[6].right - stoneSrc.right, 0);
  664.         newStone1 := oldStone1;
  665.         newStone2 := oldStone2;
  666.         oldStone1.left := oldStone1.left - 1;
  667.         oldStone2.right := oldStone2.right + 1;
  668.  
  669.         CopyBits(offVirginMap, offLoadMap, oldStone1, oldStone1, srcCopy, nil);
  670.         CopyBits(offVirginMap, offLoadMap, oldStone2, oldStone2, srcCopy, nil);
  671.         CopyBits(offVirginMap, offLoadMap, stoneSrc, newStone1, srcCopy, nil);
  672.         CopyBits(offVirginMap, offLoadMap, stoneSrc, newStone2, srcCopy, nil);
  673.         CopyBits(offLoadMap, mainWndo^.portBits, oldStone1, oldStone1, srcCopy, playRgn);
  674.         CopyBits(offLoadMap, mainWndo^.portBits, oldStone2, oldStone2, srcCopy, playRgn);
  675.  
  676.         if (oldStone2.right < 0) then
  677.             begin
  678.                 tombRects[5] := tombRects[-3];
  679.                 tombRects[6] := tombRects[-5];
  680.                 numberOfStones := numberOfStones - 2;
  681.                 stonesSliding := FALSE;
  682.             end;
  683.     end;
  684.  
  685. {=================================}
  686.  
  687. end.